<html>
<head>
<h1>Add new Faculty</h1>
</head>

<body>
<form action="addfaculty.php" method="GET">
SSN: <input type='text' name = 'ssn' /> <br/>
Faculty Id: <input type='text' name = 'fid' /> <br/>
First Name: <input type='text' name = 'fname' /> <br/>
Last Name: <input type='text' name = 'lname' /> <br/>
Designation: <input type='text' name = 'desg' /> <br/>
Salary: <input type='text' name = 'salary' /> <br/>
<input type='submit' name = 'create' value='Add'/>
</form>
</body>

<?php
	require "config.php";
	error_reporting(0);
	
	$ssn = $_GET['ssn'];
	$fid = $_GET['fid'];
	$fname = $_GET['fname'];
	$lname = $_GET['lname'];
	$desg = $_GET['desg'];
	$salary = $_GET['salary'];

	
	$con = mysql_connect("localhost",$db_user ,$db_pass);

	// if an error was encountered, the script exits with an error message
	if (!$con){
		die('Could not connect: ' . mysql_error());
    }
	//after successfully connecting with the database server, select the database with which you want to communicate
	mysql_select_db($db_name, $con);
	
	$sql_add = "INSERT INTO faculty (SSN,facultyId,firstName,lastName,designation,salary) VALUES ('$ssn','$fid','$fname','$lname','$desg','$salary');";
	$result1 = mysql_query($sql_add);
	mysql_close($con);
?>
<br />
<a href="student.php">Home</a>
</html>
